package cn.xuetian.spring.framework.custom;

import cn.xuetian.spring.framework.component.X;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;

@Component
public class BeanFactoryPostProcessorImpl implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {

        X bean = configurableListableBeanFactory.getBean(X.class);

        GenericBeanDefinition x = (GenericBeanDefinition) configurableListableBeanFactory.getBeanDefinition("x");
        x.setAttribute("x1",1);
    }
}
